<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--

	terrafirma1.0 by nodethirtythree design
	http://www.nodethirtythree.com

-->
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/>
    <title>JGarminImgParser</title>
    <meta name="keywords" content=""/>
    <meta name="description" content=""/>
    <link rel="stylesheet" type="text/css" href="default.css"/>
</head>
<body>

<div id="outer">

<div id="upbg"></div>

<div id="inner">

<div id="header">
    <h1><span>JGarminImgParser</span></h1>

    <h2>Garmin maps for Java</h2>
</div>

<div id="splash"></div>

<div id="menu">
    <ul>
        <li class="first"><a href="index.html">Home</a></li>
        <li><a href="core.html">Core library</a></li>
        <li><a href="swing.html">Swing usage</a></li>
        <li><a href="optimization.html">Optimization</a></li>
        <li><a href="screenshots.html">Screenshots</a></li>
        <li><a href="doc/index.html">JavaDoc</a></li>
        <li><a href="http://sourceforge.net/projects/jgarminimg/">Source Forge</a></li>
    </ul>
</div>

<!--<div id="date">August 1, 2006</div>
</div>-->


<div id="primarycontent">

    <!-- primary content start -->

    <div class="post">
        <div class="header">
            <h3>Swing usage</h3>
        </div>
        <div class="content">
            <p>The library comes with a Swing sample application and a set of classes that goes with. The
                application itself is <a class="code"
                                         href="doc/org/free/garminimg/swing/SampleApp.html">SampleApp</a>. To try
                it, you simply type the follwing command from the main directory:</p>
                    <pre>
    mvn compile exec:java
                    </pre>

            <p>Or use this <a href="GarminImgSampleApp.jnlp">link</a> to start it with WebStart (no download or
                installation required apart from a Java JRE).</p>

            <p>You have first to load maps by selecting a file or a whole directory in the "Open" dialog (CTRL-O).
                Then, you drag the map to move it and use the scroll-wheel to zoom.</p>

        </div>
    </div>
    <div class="post">
        <div class="header">
            <h3>How it works</h3>
        </div>
        <div class="content">
            <p>Here is the code to have a swing panel containing a map:</p>
                    <pre>
    MapPanel&lt;Point2D.Double&gt; mapPanel=
        new MapPanel(new NullConverter(), 0);

    File file=new File("/home/patrick/gps/maps/00000002.img");

    mapPanel.addMapLocation(file);
    mapPanel.showAllMap();

                    </pre>

            <p>The generic parameter of the <a class="code"
                                               href="doc/org/free/garminimg/swing/MapPanel.html">MapPanel</a>
                class defines the class used for coordinates. Then, the object passed to the constuctor defines how
                to use those coordinates to project the coordinates on the screen. In the previous example, we use
                the <a class="code" href="doc/org/free/garminimg/swing/NullConverter.html">NullConverter</a> and a
                pair of doubles as coordinates.</p>

            <p>The <a class="code" href="doc/org/free/garminimg/swing/MapPanel.html">MapPanel</a> class uses one
                thread (<a class="code" href="doc/org/free/garminimg/swing/MapPanelThread.html">MapPanelThread</a>)
                to be able to draw the map while still allowing the user to move and zoom in the map.</p>

            <p>A chain of listeners is used to draw the map:</p>
            <ul>
                <li><a class="code" href="doc/org/free/garminimg/utils/CoordinateConverterListener.html">CoordinateConverterListener</a>:
                    Does the projection of the coordinates.
                </li>
                <li><a class="code"
                       href="doc/org/free/garminimg/utils/ClippingMapListener.html">ClippingMapListener</a>: Clip
                    the map for it to remain within the extent of the display.
                </li>
                <li><a class="code" href="doc/org/free/garminimg/utils/MapDrawer.html">MapDrawer</a>: Draw the map
                    on the Swing's Graphics2D object.
                </li>
            </ul>

            <p>The <a class="code" href="doc/org/free/garminimg/utils/MapDrawer.html">MapDrawer</a> listener is
                using a <a class="code" href="doc/org/free/garminimg/utils/LabelDeClutteringFilter.html">LabelDeClutteringFilter</a>
                for having some help in drawing labels.</p>
        </div>
    </div>
    <div class="post">
        <div class="header">
            <h3>Required libraries</h3>
        </div>
        <div class="content">
            <p>Some external libraries are used in <code>SampleApp</code>:</p>
            <ul>
                <li><a href="http://xmlgraphics.apache.org/batik/">Batik</a>: export to SVG files</li>
                <li><a href="http://www.lowagie.com/iText/">iText</a>: export to PDF files</li>
            </ul>
            <p>They are included in the JGarminImgParser package.</p>
        </div>
    </div>

    <!-- primary content end -->

</div>

<div id="secondarycontent">
    <h3>Thanks</h3>

    <div class="content">
        <p>Thanks goes to:</p>
        <ul>
            <li>
                <a href="http://sourceforge.net/projects/garmin-img/">Mechalas</a> for his nice document.
            </li>
            <li>
                <a href="http://www.jetbrains.com/idea/">IntelliJ</a> for their good Java IDE.
            </li>
            <li>
                <a href="http://www.nodethirtythree.com/">NodeThirtyThree</a> for the template of this page.
            </li>
        </ul>
    </div>
</div>

<div id="footer">
    &copy;<a href="http://www.thus.ch/~patrick">Patrick Valsecchi</a>.
</div>

</div>

</div>

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
<script type="text/javascript">_uacct="UA-2624736-6";
urchinTracker();</script>
</body>
</html>
